package com.zqxq.lottery.entity.o2o.user;

import com.zqxq.common.utils.DispatcherUtils;
import com.zqxq.lottery.entity.po.user.UserAlipayPO;
import com.zqxq.lottery.entity.vo.user.UserAlipayVO;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description ：
 * @Author ： 解风
 * @Date ： 2018/03/14 16:14
 */
public class UserAlipayO2O {

    public static UserAlipayVO toVO(UserAlipayPO po) {
        if (po == null) {
            return null;
        }
        UserAlipayVO userAlipayVO = new UserAlipayVO();
        userAlipayVO.setId(DispatcherUtils.parseString(po.getId()));
        userAlipayVO.setUserId(DispatcherUtils.parseString(po.getUser_id()));
        userAlipayVO.setAlipayAccount(po.getAlipay_account());
        userAlipayVO.setAlipayKey(po.getAlipay_key());
        userAlipayVO.setStatus(DispatcherUtils.parseString(po.getStatus()));
        userAlipayVO.setCreateTime(DispatcherUtils.parseDateTimeStr(po.getCreate_time()));
        userAlipayVO.setUpdateTime(DispatcherUtils.parseDateTimeStr(po.getUpdate_time()));
        return userAlipayVO;
    }

    public static UserAlipayPO toPO(UserAlipayVO vo) {
        if (vo == null) {
            return null;
        }
        UserAlipayPO userAlipayPO = new UserAlipayPO();
        userAlipayPO.setId(DispatcherUtils.parseLong(vo.getId()));
        userAlipayPO.setUser_id(DispatcherUtils.parseLong(vo.getUserId()));
        userAlipayPO.setAlipay_account(vo.getAlipayAccount());
        userAlipayPO.setAlipay_key(vo.getAlipayKey());
        userAlipayPO.setStatus(DispatcherUtils.parseInteger(vo.getStatus()));
        userAlipayPO.setCreate_time(DispatcherUtils.parseDateTime(vo.getCreateTime()));
        userAlipayPO.setUpdate_time(DispatcherUtils.parseDateTime(vo.getUpdateTime()));
        return userAlipayPO;
    }

    public static List<UserAlipayVO> toVOList(List<UserAlipayPO> list){
        List<UserAlipayVO> result = new ArrayList();
        if(list != null && list.size() > 0){
            for (UserAlipayPO po : list) {
                result.add(toVO(po));
            }
        }
        return result;
    }


}
